Skip to content

Add Nix flake for building necessist - #2005

Open
dzmitry-lahoda wants to merge 2 commits into
trailofbits:mainfrom
dzmitry-lahoda-forks:add-nix-flake
Open

dzmitry-lahoda wants to merge 2 commits into
trailofbits:mainfrom
dzmitry-lahoda-forks:add-nix-flake

Conversation

@dzmitry-lahoda

@dzmitry-lahoda dzmitry-lahoda commented Nov 14, 2026 •

Copy link
Copy Markdown

No description provided.

@smoelius

Copy link
Copy Markdown
Collaborator

Hi, @dzmitry-lahoda. I know very little about Nix Flakes, but I would be willing to include this.

I asked Codex to review, and it produced the below. For each item, could I impose on you to explain whether it is worth fixing or not?

Codex review

The flake works on Apple Silicon macOS, but a nitpicky review turns up two packaging issues and several smaller improvements.

  1. Declare Linux runtime process tools. flake.nix (line 56)
    Necessist invokes ps, pgrep, and kill through PATH. The package doesn’t supply them. On a minimal Linux environment without these tools, normal execution can panic at ps, and timeout handling can fail. Add a Linux wrapper that supplies the required process utilities. Language-specific tools such as Cargo can reasonably remain user-provided.
  2. The license lookup produces incomplete metadata. flake.nix (line 75)
    Every platform emits:
    getLicenseFromSpdxId: No license with the given SPDX ID found: AGPL-3.0
    The resulting license contains only shortName and spdxId. Use the explicit Nixpkgs license attribute matching the repository’s licensing, or normalize the manifest identifier before lookup.
  3. Disabling all tests is broader than necessary. flake.nix (line 63)
    The integration-test explanation is reasonable, but there are offline unit tests for directives, spans, and parsing. Consider running selected library tests. The installation check exercises startup only.
  4. There are no checks outputs. flake.nix (line 25)
    nix flake check validates the package expressions but doesn’t build these packages. Exposing the package under checks.${system} would make that command verify the build and installation check too.
  5. The source filter includes substantial unrelated content. flake.nix (line 45)
    Documentation, fixtures, integration-test snapshots, and scripts all enter the build source. Changes to those files can trigger recompilation despite leaving the binary unchanged. A narrower source selection would improve caching; retain build assets and the embedded skill file.
  6. The package description becomes just "necessist". flake.nix (line 73)
    That is the manifest’s current description. Use something informative, such as “Find unnecessary code in tests.”
  7. Consider an explicit Rust version. flake.nix (line 33)
    stable.latest is reproducible with the committed overlay lock, so this is a maintenance preference: updating the overlay also upgrades the compiler implicitly. An explicit version makes compiler upgrades easier to review separately.
    Validation: all three platform expressions evaluated successfully. The macOS build command reused an existing store result; its build log confirms compilation and the installation check passed. I also ran that binary successfully against a temporary copy of fixtures/basic. Linux builds remain untested. No repository files were changed.

@dzmitry-lahoda

dzmitry-lahoda commented Nov 23, 2026 •

Copy link
Copy Markdown
Author

1 you do not want that level of isolation. you did not use nix in first place, so you did not care that level of determinism. basically current nix setup partially works as your works on my machine or in my CI - WILL NOT DO
3 unless you decide to use nix yourself and as long as i do not patch internals of code(lock/scripts), no need to run tests for nix (will same result as for not nix) - TOO BRITTLE WILL NOT DO
4 simple output, standard build, not sure if need any check after binary is built - NOT UNTIL CI ADOPTS NIX . NO SURE ANYBODY DOES THAT OFTEN
5 would not risk filter now, because filters can break builds, want to avoid broken builds, because you do not use nix - want to reduce nix build failures if they do not follow your changes - DONE used .gitignore
6

description = "necessist"
. would not use anything else to avoid breaking flake - SHOULD BE DONE IN CARGO FOR BIN
7 you did not locked rust, i would not too for now. both options i have can break. the only legit if you add rust-toolchain.toml - SHOULD BE DONE BY REPO NOT NIX

2 seems legit. will try to bind to

license = "AGPL-3.0"
- DONE

@smoelius

smoelius commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks, @dzmitry-lahoda. Could you please collapse your changes into one commit?

Also, does this change require a release?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants